<#assign resources="${rc.contextPath}/resources">
<#assign path="${rc.contextPath}">
<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta charset="UTF-8">
    <title>淘惠帮</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	 
    <link href="${resources}/plugins/fontAwesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="${resources}/plugins/swiper/3.3.1/swiper.min.css" rel="stylesheet" type="text/css">
    <link href="${resources}/css/branchselect.css" rel="stylesheet" type="text/css">
	<style type="text/css">
        body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
        html, body {
		    height: 100%;
		}
    </style>
     <#include "setwxshare.ftl"/>
</head>
	

<body>

<div id="container">
    <div class="commonHeader">网点查询
        <a href="javascript:history.go(-1)" class="fa fa-chevron-left back"></a>
    </div>

    <form class="header">
        <div class="table">
            <a href="javascript:void(0)" class="back1">
                <span>关键词</span>
            </a>
            <!--搜索框-->
            <input id="search" type="search1" placeholder="请输入关键词">
            <i class="times fa fa-times" aria-hidden="true"></i>
        </div>
    </form>
    <div class="bottomBtn">
        <a href="javascript:void(0)" onclick="searchMap()">查询</a>
    </div>
</div>

 <div id="allmap"></div>
	
</body>

<script src="${resources}/plugins/jquery/2.2.2/jquery.min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=xVvsn3oF1vhtA1Ggi4ZfW4VWWgP3wmML"></script>">
<script type="text/javascript">
	
		//删除搜索框里的内容
		$(function(){
			$(".fa-times").on("click",function(){
				$("#search").val("");
			})
		})


		//查询热搜词
		function searchMap(){
		
		
			var points=new Array();
			$.ajax({
	        		type:"post",
	        		async:true, 
		        	url:"${path}/branch/map",
					data:{
						address:$("#search").val()
					},
	        		success:function(resultjson){	
	        			if('000' == resultjson.code){
	        				var html = "";
	        				for (var i = 0; i < resultjson.result.length; i++) {
	        					points[i]=new BMap.Point(resultjson.result[i].longitude,resultjson.result[i].latitude);
	        				}	
	        				 
								//地图初始化
							    var bm = new BMap.Map("allmap");
							    bm.centerAndZoom(new BMap.Point(112.5323,37.945352), 15);
							
							    //坐标转换完之后的回调函数
							    translateCallback = function (data){
							      if(data.status === 0) {
							        for (var i = 0; i < data.points.length; i++) {
							            bm.addOverlay(new BMap.Marker(data.points[i]));
							            bm.setCenter(data.points[i]);
							        }
							      }
							    }
							    setTimeout(function(){
							        var convertor = new BMap.Convertor();
							        convertor.translate(points, 1, 5, translateCallback)
							    }, 1000);
							
	        			}
	        		}
	        })
	        
		      
		}
	

	





	

</script>
 
</html>
 
